***** Replication Data for "Seeking the Public Good: Public Service Motivation and Political Ambition" 
***** Authors: Hans J.G. Hassell, Gary E. Hollibaugh, Jr., and Matthew R. Miles
***** Email: gary.hollibaugh@pitt.edu

**** This code replicates all figures and tables in the paper and appendix, with the exceptions of
**** Figures 1, 2, and A-1. Those can be replicated by running the "Replication Code.R" R file in R.


**** National Sample Analysis ****
use "PB-NationalSample.dta", clear

*** Table A-1 
log using "Table-A1.txt", replace text
tab female
sum age
tab educ
tab race
tab PartyID
log close

*** Estimate models and marginal effects for each PSM dimension
** Models for state bureaucratic ambition 
quietly ologit statamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_statamb
quietly ologit statamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_statamb
quietly ologit statamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_statamb
quietly ologit statamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_statamb

** Models for electoral ambition
quietly ologit elecamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_elecamb
quietly ologit elecamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_elecamb
quietly ologit elecamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_elecamb
quietly ologit elecamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_elecamb

** Models for judicial ambition
quietly ologit judamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_judamb
quietly ologit judamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_judamb
quietly ologit judamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_judamb
quietly ologit judamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_judamb

** Models for federal bureaucratic ambition
quietly ologit fedamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_fedamb
quietly ologit fedamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_fedamb
quietly ologit fedamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_fedamb
quietly ologit fedamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_fedamb

** Put the marginal effects into a plot
coefplot (psmpolicy_elecamb, label(Electoral Ambition))  (psmpolicy_statamb, label(State Bureaucracy Ambition))  (psmpolicy_fedamb, label(Federal Bureaucracy Ambition)) (psmpolicy_judamb, label(Judicial Ambition)), bylabel("Attraction to Policy Making") || (psmsac_elecamb, label(Electoral Ambition))  (psmsac_statamb, label(State Bureaucracy Ambition))  (psmsac_fedamb, label(Federal Bureaucracy Ambition)) (psmsac_judamb, label(Judicial Ambition)), bylabel("Self-Sacrifice") || (psmpi_elecamb, label(Electoral Ambition))  (psmpi_statamb, label(State Bureaucracy Ambition))  (psmpi_fedamb, label(Federal Bureaucracy Ambition)) (psmpi_judamb, label(Judicial Ambition)), bylabel("Commitment to Public Interest") || (psmcomp_elecamb, label(Electoral Ambition))  (psmcomp_statamb, label(State Bureaucracy Ambition))  (psmcomp_fedamb, label(Federal Bureaucracy Ambition)) (psmcomp_judamb, label(Judicial Ambition)), bylabel("Compassion") xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap)) coeflabels(1._predict="No Interest" 2._predict="Open to Possibility" 3._predict="Working Towards It") xtitle(Marginal Effect of PSM Dimension on Indicated Outcome) ytitle(Stated Interest in Pursuing Indicated Office) scheme(s1mono) 

graph export "Figure-3.pdf", replace
graph export "Figure-3.png", replace

*** Estimate models for regression tables
** Ordered logit models
quietly ologit elecamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A5.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) replace

quietly ologit statamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A5.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m))

quietly ologit fedamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A5.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m))

quietly ologit judamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A5.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m))

** OLS models
quietly reg elecamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A8.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) replace

quietly reg statamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A8.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg fedamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A8.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg judamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A8.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

*** Components of the job
label variable psmsac "Self-Sacrifice"
label variable psmcomp "Compassion"
label variable psmpi "Commitment to Public Interest"
label variable psmpolicy "Attraction to Policy Making"

** Component labels are as follows
* Q34_8_1 "Lack of Privacy"
* Q34_8_7 "Public Scrutiny"
* Q34_8_3 "The Conflict"
* Q34_8_5 "Difficult on Family and Friends"
* Q34_8_4 "The Schedule/Traveling"
* Q34_7_4 "The Publicity"
* Q34_7_3 "Fundraising"
* Q34_7_5 "Persuading People"
* Q34_7_6 "The Competition"
* Q34_7_1 "Talking About Solutions"
* Q34_8_2 "Making Important Decisions"
* Q34_7_2 "Meeting New People"

** Cronbach's Alpha (Mentioned in footnote)
* Electoral
alpha Q34_7_3 Q34_7_4 Q34_7_5 Q34_7_6

* Publicity
alpha Q34_8_1 Q34_8_3 Q34_8_4 Q34_8_5 Q34_8_7

* Job responsibilities
alpha Q34_7_1 Q34_7_2 Q34_8_2

** Table 1/A-4
factor Q34_7_2 Q34_7_1 Q34_7_3 Q34_7_4 Q34_7_5 Q34_7_6 Q34_8_1 Q34_8_2 Q34_8_3 Q34_8_4 Q34_8_5 Q34_8_7, pcf
rotate, promax
log using "Table-1.txt", replace text
sortl 
log close

log using "Table-A4.txt", replace text
sortl 
log close

** Regression Tables in Appendix
quietly reg campaigning psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A14.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) replace

quietly reg diffcampaign psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A14.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F))

quietly reg theJob psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
outreg2 using "Table-A14.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F))

** Estimating models to use for Figure 8 in paper
quietly reg campaigning psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
estimates store estimates_electoralcomp

quietly reg diffcampaign psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
estimates store estimates_personalcomp

quietly reg theJob psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo5 PartyID i.race age educ income polknow, robust
estimates store estimates_jobcomp

coefplot(estimates_electoralcomp, label(Electoral Components)) (estimates_jobcomp, label(Job Responsibility Components)) (estimates_personalcomp, label(Personal Life Components)), xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap))  keep(psmsac psmcomp psmpi psmpolicy) scheme(s1mono) bylabels("Electoral Components" "Job Responsibility Components" "Personal Components")  xtitle(Estimated Coefficient of PSM Dimension)

graph display, scale(.8)
graph export "Figure-6.pdf", replace
graph export "Figure-6.png", replace




**** Bureaucratic Sample Analysis ****
use "PB-BureaucratSample.dta", clear

*** Table A-2
log using "Table-A2.txt", replace text
tab female
tab age
tab educ
tab raceI
tab party1
log close

*** Estimate models and marginal effects for each PSM dimension

** Models for state bureaucratic ambition
quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_statamb

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_statamb

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_statamb

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_statamb

** Models for electoral ambition
quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_elecamb

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_elecamb

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_elecamb

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_elecamb

** Models for judicial ambition
quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_judamb

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_judamb

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_judamb

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_judamb

** Models for federal bureaucratic ambition
quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_fedamb

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_fedamb

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_fedamb

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_fedamb

** Put the marginal effects into a plot
coefplot (psmpolicy_elecamb, label(Electoral Ambition))  (psmpolicy_statamb, label(State Bureaucracy Ambition))  (psmpolicy_fedamb, label(Federal Bureaucracy Ambition)) (psmpolicy_judamb, label(Judicial Ambition)), bylabel("Attraction to Policy Making") || (psmsac_elecamb, label(Electoral Ambition))  (psmsac_statamb, label(State Bureaucracy Ambition))  (psmsac_fedamb, label(Federal Bureaucracy Ambition)) (psmsac_judamb, label(Judicial Ambition)), bylabel("Self-Sacrifice") || (psmpi_elecamb, label(Electoral Ambition))  (psmpi_statamb, label(State Bureaucracy Ambition))  (psmpi_fedamb, label(Federal Bureaucracy Ambition)) (psmpi_judamb, label(Judicial Ambition)), bylabel("Commitment to Public Interest") || (psmcomp_elecamb, label(Electoral Ambition))  (psmcomp_statamb, label(State Bureaucracy Ambition))  (psmcomp_fedamb, label(Federal Bureaucracy Ambition)) (psmcomp_judamb, label(Judicial Ambition)), bylabel("Compassion") xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap)) coeflabels(1._predict="No Interest" 2._predict="Open to Possibility" 3._predict="Working Towards It") xtitle(Marginal Effect of PSM Dimension on Indicated Outcome) ytitle(Stated Interest in Pursuing Indicated Office) scheme(s1mono) 

graph export "Figure-4.pdf", replace
graph export "Figure-4.png", replace

*** Estimate models for regression tables
** Ordered logit models
quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A6.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) replace

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A6.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A6.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A6.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

** Ordered logit models without GS-13 through GS-15
quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
outreg2 using "Table-A11.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll)) replace

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
outreg2 using "Table-A11.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll)) 

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
outreg2 using "Table-A11.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll)) 

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
outreg2 using "Table-A11.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll)) 

** OLS models
quietly reg Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A9.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) replace

quietly reg Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A9.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A9.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown, robust
outreg2 using "Table-A9.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

*** Estimating models to produce marginal effects and generate plots for the sample without GS-13 through GS-15
quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_statamb_lowmid

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_statamb_lowmid

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_statamb_lowmid

quietly ologit Statamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_statamb_lowmid

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_elecamb_lowmid

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_elecamb_lowmid

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_elecamb_lowmid

quietly ologit Elecamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_elecamb_lowmid

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_judamb_lowmid

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_judamb_lowmid

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_judamb_lowmid

quietly ologit Judamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_judamb_lowmid

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_fedamb_lowmid

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_fedamb_lowmid

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_fedamb_lowmid

quietly ologit Execamb psmsac psmcomp psmpi psmpolicy open_s cons_s extra_s agree_s emotstab_s i.genderI newideo partyidI black asian other_race mixed age neweduc newincome incomeunknown if (GS != 6 & GS != 7 & GS != 8), robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_fedamb_lowmid

** Generating plot
coefplot (psmpolicy_elecamb_lowmid, label(Electoral Ambition))  (psmpolicy_statamb_lowmid, label(State Bureaucracy Ambition))  (psmpolicy_fedamb_lowmid, label(Federal Bureaucracy Ambition)) (psmpolicy_judamb_lowmid, label(Judicial Ambition)), bylabel("Attraction to Policy Making") || (psmsac_elecamb_lowmid, label(Electoral Ambition))  (psmsac_statamb_lowmid, label(State Bureaucracy Ambition))  (psmsac_fedamb_lowmid, label(Federal Bureaucracy Ambition)) (psmsac_judamb_lowmid, label(Judicial Ambition)), bylabel("Self-Sacrifice") || (psmpi_elecamb_lowmid, label(Electoral Ambition))  (psmpi_statamb_lowmid, label(State Bureaucracy Ambition))  (psmpi_fedamb_lowmid, label(Federal Bureaucracy Ambition)) (psmpi_judamb_lowmid, label(Judicial Ambition)), bylabel("Commitment to Public Interest") || (psmcomp_elecamb_lowmid, label(Electoral Ambition))  (psmcomp_statamb_lowmid, label(State Bureaucracy Ambition))  (psmcomp_fedamb_lowmid, label(Federal Bureaucracy Ambition)) (psmcomp_judamb_lowmid, label(Judicial Ambition)), bylabel("Compassion") xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap)) coeflabels(1._predict="No Interest" 2._predict="Open to Possibility" 3._predict="Working Towards It") xtitle(Marginal Effect of PSM Dimension on Indicated Outcome) ytitle(Stated Interest in Pursuing Indicated Office) scheme(s1mono) 

graph export "Figure-A2.pdf", replace
graph export "Figure-A2.png", replace




**** Law Student Analysis ****
use "PB-LawStudentSample.dta", clear

*** Table A-3
log using "Table-A3.txt", replace text
tab female
tab race
tab latino
tab pid7
tab ideology
log close

*** Estimate models and marginal effects for each PSM dimension
** Models for elected ambition 
quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_elecamb

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_elecamb

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_elecamb

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_elecamb

** Models for state and local bureaucratic ambition 
quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_statamb

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_statamb

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_statamb

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_statamb

** Models for judicial ambition 
quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_judamb

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_judamb

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_judamb

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_judamb

** Models for federal bureaucratic ambition 
quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_fedamb

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_fedamb

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_fedamb

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_fedamb

*** Put the marginal effects into a plot
coefplot (psmpolicy_elecamb, label(Electoral Ambition))  (psmpolicy_statamb, label(State Bureaucracy Ambition))  (psmpolicy_fedamb, label(Federal Bureaucracy Ambition)) (psmpolicy_judamb, label(Judicial Ambition)), bylabel("Attraction to Policy Making") || (psmsac_elecamb, label(Electoral Ambition))  (psmsac_statamb, label(State Bureaucracy Ambition))  (psmsac_fedamb, label(Federal Bureaucracy Ambition)) (psmsac_judamb, label(Judicial Ambition)), bylabel("Self-Sacrifice") || (psmpi_elecamb, label(Electoral Ambition))  (psmpi_statamb, label(State Bureaucracy Ambition))  (psmpi_fedamb, label(Federal Bureaucracy Ambition)) (psmpi_judamb, label(Judicial Ambition)), bylabel("Commitment to Public Interest") || (psmcomp_elecamb, label(Electoral Ambition))  (psmcomp_statamb, label(State Bureaucracy Ambition))  (psmcomp_fedamb, label(Federal Bureaucracy Ambition)) (psmcomp_judamb, label(Judicial Ambition)), bylabel("Compassion") xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap)) coeflabels(1._predict="No Interest" 2._predict="Open to Possibility" 3._predict="Working Towards It") xtitle(Marginal Effect of PSM Dimension on Indicated Outcome) ytitle(Stated Interest in Pursuing Indicated Office) scheme(s1mono) 

graph export "Figure-5.pdf", replace
graph export "Figure-5.png", replace



*** Estimate models and marginal effects for each PSM dimension
** Main ordered logit models
quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A7.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) replace

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A7.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A7.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A7.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

** OLS Models
quietly reg electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A10.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) replace

quietly reg statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A10.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A10.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A10.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

*** Replicating everything for public schools only
** Estimating marginal effects for each type of ambition
* Electoral ambition
quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_elecamb_public

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_elecamb_public

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_elecamb_public

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_elecamb_public

* State/local bureaucratic ambition
quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_statamb_public

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_statamb_public

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_statamb_public

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_statamb_public

* Judicial ambition
quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_judamb_public

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_judamb_public

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_judamb_public

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_judamb_public

* Federal bureaucratic ambition
quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_fedamb_public

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_fedamb_public

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_fedamb_public

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_fedamb_public

* Creating a marginal effects plot
coefplot (psmpolicy_elecamb_public, label(Electoral Ambition))  (psmpolicy_statamb_public, label(State Bureaucracy Ambition))  (psmpolicy_fedamb_public, label(Federal Bureaucracy Ambition)) (psmpolicy_judamb_public, label(Judicial Ambition)), bylabel("Attraction to Policy Making") || (psmsac_elecamb_public, label(Electoral Ambition))  (psmsac_statamb_public, label(State Bureaucracy Ambition))  (psmsac_fedamb_public, label(Federal Bureaucracy Ambition)) (psmsac_judamb_public, label(Judicial Ambition)), bylabel("Self-Sacrifice") || (psmpi_elecamb_public, label(Electoral Ambition))  (psmpi_statamb_public, label(State Bureaucracy Ambition))  (psmpi_fedamb_public, label(Federal Bureaucracy Ambition)) (psmpi_judamb_public, label(Judicial Ambition)), bylabel("Commitment to Public Interest") || (psmcomp_elecamb_public, label(Electoral Ambition))  (psmcomp_statamb_public, label(State Bureaucracy Ambition))  (psmcomp_fedamb_public, label(Federal Bureaucracy Ambition)) (psmcomp_judamb_public, label(Judicial Ambition)), bylabel("Compassion") xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap)) coeflabels(1._predict="No Interest" 2._predict="Open to Possibility" 3._predict="Working Towards It") xtitle(Marginal Effect of PSM Dimension on Indicated Outcome) ytitle(Stated Interest in Pursuing Indicated Office) scheme(s1mono) 

graph export "Figure-A3.pdf", replace
graph export "Figure-A3.png", replace

* Outputting models to a table
quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
outreg2 using "Table-A13.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) replace

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
outreg2 using "Table-A13.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
outreg2 using "Table-A13.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 0, robust
outreg2 using "Table-A13.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 


*** Replicating everything for private schools only
** Estimating marginal effects for each type of ambition
* Electoral ambition
quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_elecamb_private

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_elecamb_private

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_elecamb_private

quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_elecamb_private

* State/local bureaucratic ambition
quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_statamb_private

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_statamb_private

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_statamb_private

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_statamb_private

* Judicial ambition
quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_judamb_private

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_judamb_private

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_judamb_private

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_judamb_private

* Federal bureaucratic ambition
quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmsac)   post
estimates store psmsac_fedamb_private

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmcomp)   post
estimates store psmcomp_fedamb_private

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpi)   post
estimates store psmpi_fedamb_private

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
quietly margins, dydx(psmpolicy)   post
estimates store psmpolicy_fedamb_private

* Marginal effects plot
coefplot (psmpolicy_elecamb_private, label(Electoral Ambition))  (psmpolicy_statamb_private, label(State Bureaucracy Ambition))  (psmpolicy_fedamb_private, label(Federal Bureaucracy Ambition)) (psmpolicy_judamb_private, label(Judicial Ambition)), bylabel("Attraction to Policy Making") || (psmsac_elecamb_private, label(Electoral Ambition))  (psmsac_statamb_private, label(State Bureaucracy Ambition))  (psmsac_fedamb_private, label(Federal Bureaucracy Ambition)) (psmsac_judamb_private, label(Judicial Ambition)), bylabel("Self-Sacrifice") || (psmpi_elecamb_private, label(Electoral Ambition))  (psmpi_statamb_private, label(State Bureaucracy Ambition))  (psmpi_fedamb_private, label(Federal Bureaucracy Ambition)) (psmpi_judamb_private, label(Judicial Ambition)), bylabel("Commitment to Public Interest") || (psmcomp_elecamb_private, label(Electoral Ambition))  (psmcomp_statamb_private, label(State Bureaucracy Ambition))  (psmcomp_fedamb_private, label(Federal Bureaucracy Ambition)) (psmcomp_judamb_private, label(Judicial Ambition)), bylabel("Compassion") xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap)) coeflabels(1._predict="No Interest" 2._predict="Open to Possibility" 3._predict="Working Towards It") xtitle(Marginal Effect of PSM Dimension on Indicated Outcome) ytitle(Stated Interest in Pursuing Indicated Office) scheme(s1mono) 

graph export "Figure-A4.pdf", replace
graph export "Figure-A4.png", replace

* Outputting models to a table
quietly ologit electedofficeamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
outreg2 using "Table-A12.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) replace

quietly ologit statelocalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
outreg2 using "Table-A12.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit federalagencyamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
outreg2 using "Table-A12.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

quietly ologit judicialamb psmsac psmcomp psmpi psmpolicy open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool if private == 1, robust
outreg2 using "Table-A12.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("Log-Likelihood",e(ll),"Wald Test",e(chi2),"Prob > chi2",e(p),"Degrees of Freedom",e(df_m)) 

*** Components of the job
label variable psmsac "Self-Sacrifice"
label variable psmcomp "Compassion"
label variable psmpi "Commitment to Public Interest"
label variable psmpolicy "Attraction to Policy Making"

** Estimating models and saving marginal effects
quietly reg personalcomp psmpolicy psmpi psmsac  psmcomp   open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
estimates store estimates_personalcomp

quietly reg electoralcomp psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
estimates store estimates_electoralcomp

quietly reg jobcomp psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
estimates store estimates_jobcomp

** Generating a plot
coefplot(estimates_electoralcomp, label(Electoral Components)) (estimates_jobcomp, label(Job Responsibility Components)) (estimates_personalcomp, label(Personal Life Components)), xline(0, lwidth(thin) lpattern(dash)) levels(95 90) ciopts(recast(. rcap))  keep(psmsac psmcomp psmpi psmpolicy) scheme(s1mono) bylabels("Electoral Components" "Job Responsibility Components" "Personal Components")  xtitle(Estimated Coefficient of PSM Dimension)

graph display, scale(.8)

graph export "Figure-7.pdf", replace
graph export "Figure-7.png", replace

** Estimating models to output to a table
quietly reg electoralcomp psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A15.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) replace

quietly reg personalcomp psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A15.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F)) 

quietly reg jobcomp psmpolicy psmpi psmsac  psmcomp open consc extra agree emotstab i.gender ideo pid7 i.race polknow i.lawschool, robust
outreg2 using "Table-A15.doc", stats(coef se) sym(***,**,*) dec(3) adec(3) addstat("F Test",e(F))

